<?php
/**
 * 图片上传测试
 */
namespace app\admins\controller\test;
use \think\Controller;
use \think\facade\Debug;
class Img extends \app\admins\controller\Base {
    
    
    public function aa(){
        echo 1;exit;
    }
    
    
    public function bad(){
        
        $data = [
            'name'      => '这是一段测试语句片中国',
            'content'   => '测试文件三个拆迁，第二个福音会,第三个,第三个爱女人,还有安眠酮'
        ];
        $check = [ 'name' ];
        
        $InputFilter = \logic\sys\safe\InputFilter::getInstance();
        $save =  $InputFilter->replace($data,$check);
        $InputFilter->save('admin',1);
         $save =  $InputFilter->group('kk')->replace($data,$check);
        $bad  = $InputFilter->getFilterList();
       // dump($InputFilter);
       
       pr($bad);
        dump($save);
        return '';
        exit;
        
        
        
        
        
        $filterContent = \util\DfaFilter\SensitiveHelper::init();        
        $result =  $filterContent->setTreeByFile('porn');
        dump($filterContent);
        echo "aaaa<hr>";
        $result =  $filterContent->setTreeByFile('porn');
        
        dump($filterContent);exit;
        

        
        $content = '这是一段测试语句，请忽略赌球网, 第二个敏感词是三级片中国';
        dump($content);
        // 过滤,其中【赌球网】在词库中
        
        $filterContent = \util\DfaFilter\SensitiveHelper::init();
       //  $result =  $filterContent->setTree(true)->getBadWord($content,1,1);
        $result =  $filterContent->setTreeByFile(true)->getBadWord($content,1,1);
        
        $reg = $filterContent->setTreeByFile(true)->replace($content,'*');
        
        $mark = $filterContent->setTreeByFile(true)->mark($content,'<b>','</b>');
        dump($reg);
        dump($mark);
         
         Debug::remark('end'); 
         echo Debug::getRangeTime('begin','end').'s';
        dump($result);
        
        return '';
    }
    
    public function badf(){
        Debug::remark('begin');
        $content = '这是一段测试语句，请忽略赌球网, 第二个敏感词是三级片';
        // 过滤,其中【赌球网】在词库中
        $filterContent = \util\DfaFilter\SensitiveHelper::init();
         $result =  $filterContent->setTreeByFile(true)->getBadWord($content,1,1);
          Debug::remark('end'); 
         echo Debug::getRangeTime('begin','end').'s';
        dump($result);
        
        return '';
    }
    
    
    public function index(){
        $this->assign(get_defined_vars());
        return $this->fetch();
    }
    
    
    
    
}